﻿<!DOCTYPE html>
<!--管理制度--修改-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

    <meta charset="utf-8" />
    <title></title>
</head>

<body>
    <div id="app" class="popupW100" v-cloak>
        <!-- class="popupW100"为label宽度为100px，共有popupW50、popupW100、popupW150、popupW200可选 -->
        <el-form label-position="right" :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="100px"
                 size="mini">
            <el-row>
                <el-table stripe ref="table" :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight"
                          border @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
                    <!--序号-->
                    <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                                     show-overflow-tooltip="true"></el-table-column>

                    <!--文件级别-->
                    <el-table-column prop="mark02" :label="LawRegulationStandardSpecification.FileLeve"
                                     show-overflow-tooltip="true" min-width="110">
                    </el-table-column>

                    <!--法律法规名称-->
                    <el-table-column prop="lawRegulationsName" :label="LawRegulationsTable.LawRegulationsName"
                                     show-overflow-tooltip="true" min-width="110">
                    </el-table-column>

                    <!--发布主体-->
                    <el-table-column prop="issueSubject" :label="LawRegulationsTable.IssueSubject"
                                     show-overflow-tooltip="true" min-width="110">
                    </el-table-column>

                    <!--文号/标准号-->
                    <el-table-column prop="symbol" :label="LawRegulationsTable.Symbol"
                                     show-overflow-tooltip="true" min-width="110">
                    </el-table-column>
                    <!--符合情况-->
                    <el-table-column prop="caM_Compliance" :label="ComplianceAssessmentManag0603.CAM_Compliance"
                                     show-overflow-tooltip="true" min-width="110">
                        <!--<el-form-item :label="ComplianceAssessmentManag0603.CAM_Compliance+mark.m"
                      prop="caM_Compliance">
            <el-radio-group v-model="Form.caM_Compliance">
                <el-radio v-for="item in IsCAM_Compliance" :label="item.value" :value="item.key">
                    {{item.value}}
                </el-radio>
            </el-radio-group>
        </el-form-item>-->

                        <template scope="scope">
                            <el-radio-group v-model="scope.row.fL_StandardInformationReview[0].mark01">
                                <el-radio v-for="item in IsCAM_Compliance" :label="item.value" :value="item.key">
                                    {{item.value}}
                                </el-radio>
                            </el-radio-group>
                        </template>
                    </el-table-column>

                    <!--符合（不符合）情况说明-->
                    <el-table-column prop="CAM_ComplianceStatement" :label="ComplianceAssessmentManag0603.CAM_ComplianceStatement"
                                     show-overflow-tooltip="true" min-width="150">
                        <template scope="scope">
                            <el-input type="text" v-model="scope.row.fL_StandardInformationReview[0].mark02" autocomplete="off" size="mini">
                            </el-input>
                        </template>

                    </el-table-column>

                </el-table>
            </el-row>

            <el-row type="flex" justify="end">
                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                               :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                               :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
            <br />
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <!--<el-button type="primary" @click="onSubmitFormSH('ruleForm')">{{LawRegulationsFitAdministration.btnCommit}}</el-button>-->
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <!--分页-->
       
    </div>
    <script type="text/javascript">
        var uploadText = "请选择上传文件";
        Vue.component('treeselect', VueTreeselect.Treeselect)
        //var gutid = gutid();//取随机主键
        //function gutid() {
        //    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        //        var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
        //        return v.toString(16);
        //    });
        //};

        //取序号
      //  var gunstN = parent.$ManagementSystem.Arrays.length
        //var gutNum = gunstN + 1;


        //var gutNum = gutNum();
        //function gutNum() {
        //    ufoiNum = ufoiNum + 1;
        //    return ufoiNum;
        //};




        var app = new Vue({
            el: '#app',
            data: {
                ListItem1: {
                    //tableDate: {
                    tablebox1: [],
                    tablebox2: [],
                    tablebox3: [],
                    //},
                },
                //表单内容
                ListItem: ListItem,
                formInline: {
                    //  model: { years: '' },
                    model: {},
                },
                offset: 0,
                limit: 10,
                //父业传参
                id: '',
                show: '',
                FL_SystemFileLevel: [],
                sysUser: [],
                Person: [],
                Person2: [],
              //  UserList: [],
                //获取下拉菜单sex
                // sex: [],
                //业务表单内容
                Form: {
                   
                    inputPerson: '',
                    fileLeve: '',
                    gkbm: null,
                  //  camPersonid: null,
                    Mark04: '',
                    Mark07: '',
                    Mark03: '',
                    UserId:'',
                   // sysUser: [],   //id: guidEmpty,
                    id: guidEmpty,
                    // MS_Id: gutNum, // '999999',
                    MS_Id: '',
                    MS_InstitutionName: '',
                    MS_FileNo: '',
                    MS_Sort: '',
                    LBSorts: '',
                    Dycle: '',
                    MS_ReviewDate: '',
                    MS_ImplementationDate: '',
                    attachment: '',
                    attachmentName: '',
                    IsHSE: '',  //是否是HSE类别
                    RDepartments: '',//相关部门
                    multiple: true,
                    Department: [],
                    departmentId1: null,
                    FL_SystemDept: [],
                    MS_ReviewCycle: '',
                    MS_RevisionTime: '',
                    Person: [],
                    PJPerSon: '',
                    powerid: guidEmpty,
                    FL_StandardInformationReview: [],
                    years: '',
                    auditor: '',
                    approver: '',
                    caM_Compliance: '',
                },
                //  LBSorts: [],
                //  IsHSE: [],
                //  RDepartments: [],
                //表单验证
                rules: {
                    //MS_InstitutionName: [
                    //    verification.NotNull
                    //],
                    //MS_FileNo: [
                    //    verification.NotNull
                    //],
                    ////MS_Sort: [
                    ////    verification.NotNull,
                    ////],
                    ////MS_IsHSE: [
                    ////    verification.NotNull,
                    ////],
                    //Dycle: [
                    //    verification.NotNull,
                    //],
                    //MS_ImplementationDate: [
                    //    verification.NotNull,
                    //],
                    //MS_ReviewDate: [
                    //    verification.NotNull,
                    //],
                    //MS_RelevantDepartments: [
                    //    verification.NotNull,
                    //],

                },
                //IsCAM_Compliance: [],
                IsCAM_Compliance: [],
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                //初始化数据
                GetPageData: function (currentIndex) {
                    this.formInline.model.years = this.Form.years
                    GetPageData(this, currentIndex, '/api/FL_Evaluation/GetDepPSEditList')
                        },
       
                // 列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

                attachmentHandle: function (response, fileid, fileName) {

                    console.log('fileid', fileid)
                    console.log('fileName', fileName)

                    this.Form.attachment = fileid;
                    this.Form.attachmentName = fileName;

                    console.log(' this.Form.attachment', this.Form.attachment)
                    console.log(' this.Form.attachmentName', this.Form.attachmentName)

                },
                handleRemove: function (file) {
                    console.log(file);
                },
                handlePreview: function (file) {
                    console.log(file.name);
                    window.open(file.url)
                },
                //table选中行handle
                tableHandleCurrentChange: function (currentRow) {
                    this.currSeelctId = currentRow.id;
                    this.currSeelctCell = currentRow;
                },
                btnAttachmentUpload: function () {
                    //若更换文件则将文件名字更换触发条件--先删除上一个文件,后添加一个文件
                    if (this.fileAttachmentUpload != uploadText) {
                        this.$refs.Attachmentupload.clearFiles();
                        this.fileAttachmentUpload = file.name;
                    }
                    else {

                    }
                    this.$refs.Attachmentupload.submit();
                },

                input: function (value) {
                    this.Form.Department = value;
                },
                //人员类别
                getPersonData: function () {
                    var mythis = this;
                    myAjax("post", mythis, '/api/FL_Evaluation/GetUserList', { model: {}, offset: 0, limit: 100 }, function (response) {
                        mythis.Person = response.data;
                        mythis.Person2 = response.data;
                    });
                },
                //提交数据
                onSubmitForm: function (formName) {
                    //console.log("xxxxx890xxxxxxx");
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                          //  this.Form.FL_StandardInformationReview = [];
                            //this.Form.FL_StandardInformationReview.CAM_Dept = this.ListItem.tableData.Mark04;
                         
                            //this.Form.FL_StandardInformationReview.forEach(function (a) {
                            //    this.ListItem.tableData.Mark04.push(a.CAM_Dept);
                            //});

                            console.log(mythis.Form)

                            if (!mythis.Form.fL_StandardInformationReview) {
                                mythis.Form.fL_StandardInformationReview = [];
                            }
                            mythis.ListItem.tableData.forEach(function (a) {
                                mythis.Form.fL_StandardInformationReview.push({
                                    cAM_Dept: a.gkbm,
                                    cAM_ReviewPerson: a.fL_StandardInformationReview[0].caM_ReviewPerson,
                                    fitSituation: a.fL_StandardInformationReview[0].mark01,
                                    fitSituationOrNotDescribe: a.fL_StandardInformationReview[0].mark02,
                                    id: a.fL_StandardInformationReview[0].id
                                });
                            });
                         
                            console.log(mythis.Form)
                            onSubmitForm(mythis, '/api/FL_Evaluation/EditSavePS', mythis.Form);
                        } else {
                            //验证失败
                            showMessage(msg.NoMust, 'error');

                            return false;
                        }
                    });
                },
                //提交审核
                onSubmitFormSH: function (formName) {
                    //console.log("xxxxx890xxxxxxx");
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            //  this.Form.FL_StandardInformationReview = [];
                            //this.Form.FL_StandardInformationReview.CAM_Dept = this.ListItem.tableData.Mark04;

                            //this.Form.FL_StandardInformationReview.forEach(function (a) {
                            //    this.ListItem.tableData.Mark04.push(a.CAM_Dept);
                            //});

                            console.log(mythis.Form)

                            if (!mythis.Form.fL_StandardInformationReview) {
                                mythis.Form.fL_StandardInformationReview = [];
                            }
                            mythis.ListItem.tableData.forEach(function (a) {
                                mythis.Form.fL_StandardInformationReview.push({
                                    cAM_Dept: a.gkbm,
                                    cAM_ReviewPerson: a.fL_StandardInformationReview[0].caM_ReviewPerson
                                });
                            });

                            console.log(mythis.Form)
                            onSubmitForm(mythis, '/api/FL_Evaluation/EditSaveSH', mythis.Form);
                        } else {
                            //验证失败
                            showMessage(msg.NoMust, 'error');

                            return false;
                        }
                    });
                },
                getData: function () {
                    //console.log("获取编辑数据开始");
                    getData(this, '/api/FL_Evaluation/get?id=' + this.id);
                    //this.Form.sex = this.Form.sex + "";
                    //console.log(this.id);
                    //console.log("获取编辑数据结束");
                },
            },
            mounted: function () {
                this.powerid = getUrlParam("t");
                this.getPersonData();
                this.id = getUrlParam("id");
                this.getData();
                this.GetPageData(1);

                this.IsCAM_Compliance = [
                    {
                        value: '符合',
                        key: '1'
                    },
                    {
                        value: '不符合',
                        key: '0'
                    }
                ];

                //读取数据到表格数据对象
               // this.ListItem.tableData = this.Form.FL_StandardInformationReview;
               
                //if (this.powerid == "sh" || this.powerid == "tj") {
                //    this.editRead = false;
                //}
                //else {
                //    this.editRead = true;
                //}
            },
          
        });
    </script>
</body>

</html>